var dbConfig = require('../util/dbconfig');
const dao =require('../util/dao')

// 一级商品分类
var getOneSort =(req,res)=>{
    var sql ='select * from emps where parent_id is null';
    var sqlArr = [];
    var callBack=(err,data)=>{
        if(err) {
            res.send(dao.fail(500,'失败'))
        }
        res.send(dao.ok(data))
    }
    dbConfig.sqlConnect(sql,sqlArr,callBack)
}

// 二级商品分类   品牌
var getTwoSort=(req,res)=>{
    var obj=req.params
    var sql='select * from emps where parent_id=?';
    var sqlArr=[obj.fid]
    var callBack=(err,data)=>{
        if(err) {
            res.send(dao.fail(500,'失败'))
        }
        res.send(dao.ok(data))
    }
    dbConfig.sqlConnect(sql,sqlArr,callBack)
    
}



module.exports = {getOneSort,getTwoSort};
